<?php
$width=Yii::app()->params['dialog']['findStaffForCollection']['width'];
$height=Yii::app()->params['dialog']['findStaffForCollection']['height'];
$cs=Yii::app()->clientScript;
$cs->registerScriptFile('./js/modal.js');
$cs->registerScript('truck_staff_coll_dialog',<<<END
function Block(){
 \$.modal('?r=dialog/findStaffForCollection&examine_date='+$("#examine_date").val(),{width:$width,height:$height,title:"请选择员工"});return false;}
$("#findStaff").click(Block);
var staff_coll;
function check_staff(){
	var vaild=true;
	var validator=$("form").validate();
	vaild=validator.element($('#Staff_collection_fk_driver_id'))?vaild:false;
	vaild=validator.element($('#examine_date'))?vaild:false;
	if(!vaild)return;
	$.ajax({'type':'POST','url':'?r=staff_collection/checkStaffCollection','async':false,'cache':false,'data':'fk_driver_id='+$("#Staff_collection_fk_driver_id").val()+'&examine_date='+$("#examine_date").val(),'success':function(data){staff_coll=data;}});
	if(staff_coll!=1) {alert("此司机"+$("#examine_date").val()+"工作评比已添加!");return false;}
	return true;
}
if(!'$update') $('form').submit(check_staff);
END
)
?>
<div class="yiiForm">
<?php
	echo EHtml::form();	
	EHtml::setOptions(array('errorElement'=> 'span'));
	EHtml::setScenario($update ? 'update' : 'create');				  		
?>
<div>注：<span class="required">*</span>为必填项</div>
<div id="leftaa">
<div class="simple">
<?php echo CHtml::activeLabelEx($model,'examine_date'); ?>
<?php $arr=array('id'=>'examine_date','size'=>8); if($update) $arr+=array('value'=>substr($model->examine_date,0,7),'class'=>'readonly','readOnly'=>'true'); echo EHtml::activeTextField($model,'examine_date',$arr); ?>
<?php if(!$update) $this->widget('application.extensions.calendar.SCalendar',array('inputField'=>'examine_date','ifFormat'=>'%Y-%m',));?>
</div>
<div class="simple1">
<?php echo CHtml::activeLabelEx($model,'name'); ?>
<?php echo EHtml::activeTextField($model,'name',array('size'=>8,'class'=>'readonly','readOnly'=>'true')); ?>
<?php echo CHtml::activeHiddenField($model,'fk_driver_id'); ?>
<?php if(!$update):?>&nbsp;&nbsp;<a id="findStaff" href="#">查找司机</a><?php endif;?>
</div>
<div class="simple">
<?php echo CHtml::activeLabelEx($model,'present_rate'); ?>
<?php echo EHtml::activeTextField($model,'present_rate',array('value'=>$model->present_rate*100,'size'=>8)); ?>
</div>
<div class="simple1">
<?php echo CHtml::activeLabelEx($model,'receipt_rate'); ?>
<?php echo EHtml::activeTextField($model,'receipt_rate',array('value'=>$model->receipt_rate*100,'size'=>8)); ?>
</div>
<div class="simple">
<?php echo CHtml::activeLabelEx($model,'profit_rate'); ?>
<?php echo EHtml::activeTextField($model,'profit_rate',array('value'=>$model->profit_rate*100,'size'=>8)); ?>
</div>
<div class="simple1">
<?php echo CHtml::activeLabelEx($model,'incentive_amount'); ?>
<?php echo EHtml::activeTextField($model,'incentive_amount',array('size'=>8)); ?>
</div>
<div class="simple">
<?php echo CHtml::activeLabelEx($model,'aog_rate'); ?>
<?php echo EHtml::activeTextField($model,'aog_rate',array('value'=>$model->aog_rate*100,'size'=>8)); ?>
</div>
<div class="simple1">
<?php echo CHtml::activeLabelEx($model,'exception_rate'); ?>
<?php echo EHtml::activeTextField($model,'exception_rate',array('value'=>$model->exception_rate*100,'size'=>8)); ?>
</div>
<div class="simple">
<?php echo CHtml::activeLabelEx($model,'attendance_rate'); ?>
<?php echo EHtml::activeTextField($model,'attendance_rate',array('value'=>$model->attendance_rate*100,'size'=>8)); ?>
</div>
</div>
<div id="rightaa">
<div class="simple">
<?php echo CHtml::activeLabelEx($model,'accident_times'); ?>
<?php echo EHtml::activeTextField($model,'accident_times',array('size'=>8)); ?>
</div>
<div class="simple1">
<?php echo CHtml::activeLabelEx($model,'amerce'); ?>
<?php echo EHtml::activeTextField($model,'amerce',array('size'=>8)); ?>
</div>
<div class="simple">
<?php echo CHtml::activeLabelEx($model,'sanitation_info'); ?>
<?php echo EHtml::activeTextField($model,'sanitation_info',array('size'=>8,'maxlength'=>100)); ?>
</div>
<div class="simple1">
<?php echo CHtml::activeLabelEx($model,'non_uniform_times'); ?>
<?php echo EHtml::activeTextField($model,'non_uniform_times',array('size'=>8)); ?>
</div>
<div class="simple">
<?php echo CHtml::activeLabelEx($model,'fight_times'); ?>
<?php echo EHtml::activeTextField($model,'fight_times',array('size'=>8)); ?>
</div>
<div class="simple1">
<?php echo CHtml::activeLabelEx($model,'non_obey_times'); ?>
<?php echo EHtml::activeTextField($model,'non_obey_times',array('size'=>8)); ?>
</div>
<div class="simple">
<?php echo CHtml::activeLabelEx($model,'reject_call_times'); ?>
<?php echo EHtml::activeTextField($model,'reject_call_times',array('size'=>8)); ?>
</div>
<div class="simple1">
<?php echo CHtml::activeLabelEx($model,'dci_times'); ?>
<?php echo EHtml::activeTextField($model,'dci_times',array('size'=>8)); ?>
</div>
<div class="simple">
<?php echo CHtml::activeLabelEx($model,'clients_complain_times'); ?>
<?php echo EHtml::activeTextField($model,'clients_complain_times',array('size'=>8)); ?>
</div>
</div>
<div class="action">
<?php echo EHtml::submitButton($update ? '更新信息' : '添加信息'); ?>
</div>

<?php echo EHtml::endForm(); ?>

</div><!-- yiiForm -->